package cn.com.cennavi.bean;

import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.ParseException;
import com.vividsolutions.jts.io.WKTReader;

public class R_G_DATA {
	/**
	 * linkid
	 */
	public String linkId;
	/**
	 * link的长度
	 */
	public String linklength;
	/**
	 * link形状
	 */
	public Geometry linkSeqGEO;

	public static R_G_DATA parseData(String line) throws ParseException {
		R_G_DATA data = new R_G_DATA();
		String[] arr = line.split("\\:");
		if (arr.length != 10)
			return null;
		data.linkId = arr[0];
		data.linklength = arr[7];
		data.linkSeqGEO = new WKTReader().read(arr[9]);
		return data;
	}

	public static void main(String[] args) throws ParseException {
		// TODO Auto-generated method stub
		String line = "671744:740157:740174:2:0x03:0x0a:11:33:70:LINESTRING (116.42407 39.9887, 116.42446 39.98871)";
		R_G_DATA data = R_G_DATA.parseData(line);
		System.out.println(data.linkId);

	}

}
